﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using LowLevelGraphics;
using LowLevelGraphics.Filter;

namespace ImageRecognition2.Forms
{
    /// <summary>
    /// Gabor Filter Form
    /// </summary>
    public partial class FormGabor : FormFilter
    {
        protected Gabor m_Gabor = new Gabor();
        
        /// <summary>
        /// 
        /// </summary>
        public FormGabor()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackbAmount_Scroll_1(object sender, EventArgs e)
        {
            UnsafeBitmap bitmap = new UnsafeBitmap((Bitmap)m_ImageOriginal.Clone());
            m_Gabor.Orientation = trackbAmount.Value;
            m_Gabor.Execute(bitmap).UnlockImage();

            pictureBox1.BackgroundImage = bitmap.InternalBitmap;
            pictureBox1.Invalidate();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trackbFrequency_Scroll(object sender, EventArgs e)
        {
            UnsafeBitmap bitmap = new UnsafeBitmap((Bitmap)m_ImageOriginal.Clone());
            m_Gabor.Frequency = trackbFrequency.Value;
            m_Gabor.Execute(bitmap).UnlockImage();

            pictureBox1.BackgroundImage = bitmap.InternalBitmap;
            pictureBox1.Invalidate();
        }

        private void trackbAmount_ValueChanged(object sender, EventArgs e)
        {
            UnsafeBitmap bitmap = new UnsafeBitmap((Bitmap)m_ImageOriginal.Clone());
            m_Gabor.Orientation = trackbAmount.Value;
            m_Gabor.Execute(bitmap).UnlockImage();

            pictureBox1.BackgroundImage = bitmap.InternalBitmap;
            pictureBox1.Invalidate();
        }

        private void trackbFrequency_ValueChanged(object sender, EventArgs e)
        {
            UnsafeBitmap bitmap = new UnsafeBitmap((Bitmap)m_ImageOriginal.Clone());
            m_Gabor.Frequency = trackbFrequency.Value;
            m_Gabor.Execute(bitmap).UnlockImage();

            pictureBox1.BackgroundImage = bitmap.InternalBitmap;
            pictureBox1.Invalidate();
        }
    }
}
